home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls089.ibmaix.Z / tls089.ibmaix / lib / vtcl / tests / pixmap.tcl < prev    next >
Encoding:
Text File  |  1995-07-20  |  1.8 KB  |  84 lines

  1. # CVS $Id: pixmap.tcl,v 1.4 1995/02/13 14:23:58 zibi Exp $
  2. #
  3. # allows browsing of a pixmap directory
  4. #
  5.  
  6. source tools.tcl
  7.  
  8. global pDir
  9. global lst
  10.  
  11. proc selectCB {parent cbs} {  
  12.     global pDir
  13.     global icon icon2 icon3
  14.  
  15.     set file "$pDir/[keylget cbs selectedItemList]"
  16.       echo "File is " $file "\n"
  17.  
  18.     if {! [info exists icon]} {
  19.         set fn [VtFormDialog $parent.picture -modeless \
  20.                -wmDecoration {TITLE BORDER} ]
  21.         VtLabel $fn.Label -labelCenter -leftSide FORM -rightSide FORM
  22.         set icon [VtLabel $fn.icon -pixmap $file]
  23.         VtLabel $fn.Pixmap -labelCenter -leftSide FORM -rightSide FORM
  24.         set icon2 [VtPushButton $fn.icon2 -pixmap $file ]
  25.         VtLabel $fn.ip \
  26.              -label "Insensitive Pixmap" \
  27.              -labelCenter -leftSide FORM -rightSide FORM
  28.         set icon3 [VtPushButton $fn.icon3 -pixmap $file -sensitive 0]
  29.         VtManage $fn
  30.     }
  31.     
  32.     VtSetValues $icon -pixmap $file
  33.     VtSetValues $icon2 -pixmap $file
  34.     VtSetValues $icon3 -pixmap $file
  35. }
  36.  
  37. proc setPDirCB {cbs} {
  38.     global pDir
  39.     global lst
  40.  
  41.     set dir [keylget cbs value]
  42.       echo "Dir is " $dir "\n"
  43.     
  44.     set ret [catch {cd $dir} errMsg]
  45.     if {$ret != 0} {
  46.         echo "\n\nError: $errMsg\n"
  47.         return
  48.     }
  49.     set pDir $dir
  50.     set files [glob  *]
  51.  
  52.     VtSetValues $lst -itemList $files
  53. }
  54.  
  55. if { [file isdirectory /usr/include/X11/bitmaps/xdt_p_large] } {
  56.     set pDir "/usr/include/X11/bitmaps/xdt_p_large"
  57.     #set pDir "/u/gko/X11/WidgetServer/ms/wstcl/tests"
  58. } else {
  59.     set pDir [pwd]
  60. }
  61.  
  62. set ap [VtOpen pixmaps]
  63.  
  64. set fn [VtFormDialog $ap.form -okLabel Exit -okCallback QuitCB ]
  65.  
  66. VtLabel $fn.lab -label "Directory to browse"
  67.  
  68. VtText $fn.txt -value $pDir -columns 50 -callback setPDirCB
  69.  
  70. cd $pDir
  71. set files [glob  *.px]
  72.  
  73. set lst [VtList $fn.list \
  74.         -itemList "$files" \
  75.         -rows 8\
  76.         -callback "selectCB $fn" \
  77.         -leftOffset 6 -leftSide FORM \
  78.         -rightSide FORM \
  79.         -topOffset 5 -bottomSide FORM ]
  80.  
  81. VtShow $fn
  82.  
  83. VtMainLoop
  84.